<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:choose>
    <c:when test="${book==null}">

        <jsp:forward page="/all"></jsp:forward>

    </c:when>
    <c:otherwise>


        <html>

        <head>
            <base href="<%=basePath %>">
            <title>Title</title>
        </head>
        <body>
        <div style="width:600px;margin: auto">
            <form action="all">
                <select name="b">
                    <option value ="0"> </option>
                    <option value ="1">书名</option>
                    <option value="2">作者</option>
                    <option value="3">出版社</option>
                </select>
                <%--<% String a=request.getParameter("b");%>--%>
                <input type="text" name="bookName"/>
                <input type="submit"  value="搜索"/>
            </form>
            <table border="1" width="80%">
                <tr><th colspan="6"><a href="tz" style='color:red'>增加图书</a></th ></tr>
                <tr style="background-color: blue">
                    <th>书名</th>
                    <th>作者</th>
                    <th>出版社</th>
                    <th>页数</th>
                    <th>价格</th>
                    <th><a href="update"></a></th>
                </tr>

                <c:forEach items="${book}" var="book">
                    <tr>

                        <td>${book.bookName}</td>
                        <td>${book.bookAuthor}</td>
                        <td>${book.bookPublish}</td>
                        <td>${book.bookPage}</td>
                        <td>${book.bookPrice}</td>
                        <td><a href="update">修改</a></td>
                    </tr>
                </c:forEach>

            </table>
        </div>
        </body>
        </html>
    </c:otherwise>
</c:choose>